package cn.com.roy.thread.t3_1_11.p_c_allWait;

public class RunCls {
    public static void main(String[] args) {
        String lock = new String("");
        P p = new P(lock);
        C c = new C(lock);

        ThreadP[]  tps = new ThreadP[2];
        ThreadC[] tcs = new ThreadC[2];

        for (int i = 0; i < 2; i++) {
            tps[i] = new ThreadP(p);
            tcs[i] = new ThreadC(c);

            tcs[i].start();
            tps[i].start();

        }

        Thread[] threads = new Thread[Thread.currentThread().getThreadGroup().activeCount()];
        Thread.currentThread().getThreadGroup().enumerate(threads);

        for (int i = 0; i < threads.length; i++) {
            System.out.println(threads[i].getName()+ " " + threads[i].getState());
        }


    }
}
